
Script Tag Library
Copyright 2010 Stani Ryabenkiy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


=====================================================================


The Script Tag Library allows to use the javax.script API defined by 
JSR-223 in order to use languages other than Java to script JSP pages.


COMPILATION
===========

Compilation requires the classpath to contain the javax.script API 
(provided by Java 6 or by other packages such as BSF 3.0) as well as 
the Servlet API and JSP API (provided by most servlet containers.

The included Ant build script (build.xml) can be used to compile and
package the taglib into a Jar file. It requires Java 6 and references
two files for the Servlet and JSP classes. These properties, "servlet.jar"
and "jsp.jar", are located at the top of the build script and must be 
modified to point to the appropriate locations of such files. 


DEPLOYMENT
==========

Create a Jar with the classes and deploy it to WEB-INF/lib directory 
of your web application or place the classes into WEB-INF/classes.

Also deploy to WEB-INF/lib whatever scripting language is to be used. 
Many Java-based scripting languages now ship with JSR-223 adapters.

Place the script taglib TLD (script-taglib.tld) into WEB-INF directory.

Place a taglib entry into the web application deployment descriptor 
(WEB-INF/web.xml), mapping an URI to the TLD. The entry should look
like this:

<jsp-config>
    <taglib>
        <taglib-uri>http://tomcat.apache.org/taglibs/script-1.0</taglib-uri>
        <taglib-location>/WEB-INF/script-taglib.tld</taglib-location>
    </taglib>
</jsp-config>

If using a Java version below Java 6, also deploy an alternative 
javax.script API such as BSF 3.0. 


USAGE
=====

Place the taglib directive at the beginning of your JSP page:

<%@ taglib uri="http://tomcat.apache.org/taglibs/script-1.0" prefix="script" %>

Place scriptlets and expressions inside appropriate tags:

<script:scriptlet language="rexx">
...
</script:scriptlet>

<script:expression language="rexx">
...
</script:expression>

The language parameter can point to any language for which you have 
deployed a ScriptEngine. 

Scriptlets and expressions have access to the same implicit objects
that normal JSP scriptlets have access to, namely:  request, response, 
pageContext, session, application, out, and config.

